/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GraphPackage;

import java.util.List;

/**
 *
 * @author Heather
 */
public class CCPVGraphMember {

  public static enum ValueTypes {coalition, group};
  public ValueTypes valueType = ValueTypes.group;
  public String name = "";
  // could be an int[] or a List<int[]>, depending on if it's a cross section or coalition
  private List<int[]> coalition;
  private int[] group;

  public CCPVGraphMember(Object toGraph) throws IllegalArgumentException
  {
    if (toGraph instanceof List)
    {
      valueType = ValueTypes.coalition;
      coalition = (List<int[]>)toGraph;
    }
    else if (toGraph instanceof int[])
    {
      valueType = ValueTypes.group;
      group = (int[])toGraph;
    }
    else
      throw new IllegalArgumentException("Input object of graph value not allowed.");
  }

  public Object getGraphObject()
  {
    if (valueType == ValueTypes.coalition)
      return coalition;
    else if (valueType == ValueTypes.group)
      return group;
    else
      return null;
  }
}
